package com.cw2.structural.flyweight;

/**
 * 享元模式
 */
public class MainTest {
    public static void main(String[] args) {
        // 测试享元模式
        AbstractWaitressFlyweight waitress1 = ZuDao.getWaitress("");
        waitress1.isService(); // 开始使用
        System.out.println(waitress1);
        System.out.println(waitress1.canService);

        AbstractWaitressFlyweight waitress2 = ZuDao.getWaitress("");
        waitress2.isService(); // 第二个开始使用
        System.out.println(waitress2);

        waitress1.end();
        System.out.println(waitress1.canService);
    }
}
